package com.ft.oa.domain.project;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ft.oa.utils.SecurityUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 质保回款记录尾款
 * @author liyansheng
 * @ClassName WarrantyReturnedMoney
 * @date 2022-1-14 09:36:46
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "warranty_returned_money",autoResultMap = true)
public class WarrantyReturnedMoney {

    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 父id
     */
    private Long parentId;

    /**
     * 回款金额
     */
    private BigDecimal returnedMoney;

    /**
     * 尾款金额
     */
    private BigDecimal finalPayment;

    /**
     * 剩余比率
     */
    private BigDecimal finalRate;

    /**
     * 回款日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
    private LocalDate returnedDate;

    /**
     * 回款描述
     */
    private String returnedMemo;

    /**
     * 创建人id
     */
    private Long creator = SecurityUtils.getCurrentUser().getId();

    /**
     * 创建时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd hh:mm:ss")
    private LocalDateTime createTime = LocalDateTime.now();

    /**
     * 修改人id
     */
    private Long editor = SecurityUtils.getCurrentUser().getId();

    /**
     * 修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd hh:mm:ss")
    private LocalDateTime updateTime = LocalDateTime.now();
    /**
     * 回款次数
     */
    @TableField(exist = false)
    private int moneyTimes;
}
